package dieciLuglio;

import java.io.*;
import java.net.*;



public class ProvaCl {
	BufferedReader br=null;
	static PrintWriter pr=null;

	public ProvaCl(){
		System.out.println("client partito");
		try {
			Socket socket=new Socket("localhost",3001);
			
			OutputStreamWriter osw=new OutputStreamWriter(socket.getOutputStream());
			BufferedWriter br1=new BufferedWriter(osw);
			pr=new PrintWriter(br1,true);
			
			pr.println("c");
			
			ObjectInputStream input = new ObjectInputStream (socket.getInputStream());
			System.out.print ("messaggio dal server:");
			Object m=input.readObject();

			Alimento a=(Alimento)m;
			System.out.println(a);
			socket.close();
			System.out.println("client chiuso");
			
			
			
			
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	
	public static void main(String [] args){
		/*
		try{
			System.out.println("client partito");
			Socket socket=new Socket("localhost",3001);
			Scanner sc=new Scanner(System.in);
			String comando=sc.nextLine();
			OutputStreamWriter osw=new OutputStreamWriter(socket.getOutputStream());
			BufferedWriter br1=new BufferedWriter(osw);
			pr=new PrintWriter(br1,true);
			
			pr.println(comando);
			
			ObjectInputStream input = new ObjectInputStream (socket.getInputStream());
			System.out.print ("messaggio dal server:");
			Object m=input.readObject();

			Alimento a=(Alimento)m;
			System.out.println(a);
			socket.close();
			System.out.println("client chiuso");
		}catch(Exception r){
			System.err.println(r);
	
		}
		
		System.out.print("HELLO");*/
		ProvaCl cp=new ProvaCl();
	}	
	
}
